package com.cy.service.impl;

import com.cy.dao.AccountDao;
import com.cy.entity.Account;
import com.cy.service.AccountService;

import java.sql.SQLException;
import java.util.List;

/**
 * @Author : 残影
 * @Date: 2020-09-14 09:48
 */
public class AccountServiceImpl implements AccountService {
    private AccountDao accountDao;

    public void setAccountDao(AccountDao accountDao) {
        this.accountDao = accountDao;
    }

    @Override
    public void saveAccount(Account account) throws SQLException {
        accountDao.save(account);
    }

    @Override
    public void updateAccount(Account account) throws SQLException {
        accountDao.update(account);
    }

    @Override
    public void deleteAccount(Integer accountId) throws SQLException {
        accountDao.delete(accountId);
    }

    @Override
    public Account findAccountById(Integer accountId) throws SQLException {
        return accountDao.findById(accountId);
    }

    @Override
    public List<Account> findAllAccount() throws SQLException {
        return accountDao.findAll();
    }
}
